package main

import (
	"bufio"
	"encoding/json"
	"fmt"
	"os"
)

func main() {
	f, err := os.Open("/Users/yangzhenyu/Desktop/gitee/Go/foundation/day13/ZerologWrite/foo.log")
	if err != nil {
		panic(err)
	}
	defer f.Close()
	scanner := bufio.NewScanner(f)  // 包装 f 提供 buffer 缓冲能力
	for scanner.Scan() /*扫描行分隔符*/ { // EOF就返回 false
		line := scanner.Text() // 读取当前行
		data := make(map[string]any)
		err := json.Unmarshal([]byte(line), &data)
		if err != nil {
			continue
		}
		fmt.Printf("%T %[1]v\n", data)
	}
}
